package com.ukao.cashregister.eventbus;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by ukaodev on 2017/6/3.
 */

public class PayEvent<T> {
    public T data;
    public Message msg;

    public static enum Message {
        PAY_SUCCEED, coupon,banlance,recharge,sendMode,returnWash,look_use


    }

    public PayEvent() {

    }

    public PayEvent(Message msg, T data) {
        this.msg = msg;
        this.data = data;
    }
    public PayEvent(Message msg) {
        this.msg = msg;
    }

    public Message getMessage() {
        return msg;
    }

    public <T> T getData() {
        if (data == null) {

        }
        return (T) data;
    }

    public static <T> void postHasData(Message msg, T data) {
        EventBus.getDefault().postSticky(new PayEvent(msg, data));
    }
    public static <T> void postNoData(Message msg) {
        EventBus.getDefault().post(new PayEvent(msg));
    }
}
